package com.tiantianyuegou.view.refresh;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListAdapter;
import android.widget.ListView;

import com.tiantianyuegou.R;

/**
 * 
 *@Title:下拉刷新listview
 *@Description:
 *@Author:xianwei.fu
 *@Since:2015-7-20
 *@Version:1.1.0
 */
public class PullToRefreshListView extends PullToRefreshBase<ListView> {

	public PullToRefreshListView(Context context) {
		this(context, null);
	}

	public PullToRefreshListView(Context context, AttributeSet attrs) {
		super(context, attrs);

	}

	@Override
	protected ListView createRefreshView(Context context, AttributeSet attrs) {
		ListView listView = new InternalListView(context, attrs);
		listView.setId(R.id.list);
		return listView;
	}

	protected class InternalListView extends ListView {

		public InternalListView(Context context, AttributeSet attrs) {
			super(context, attrs);
		}

		@Override
		protected void dispatchDraw(Canvas canvas) {
			try {
				super.dispatchDraw(canvas);
			} catch (Exception e) {
			}
		}

		@Override
		public boolean dispatchTouchEvent(MotionEvent ev) {
			try {

				return super.dispatchTouchEvent(ev);
			} catch (Exception e) {
			}
			return false;
		}

		@Override
		public void setAdapter(ListAdapter adapter) {
			super.setAdapter(adapter);
		}

	}

}
